{$CLEO .cs}
{$USE cleo+}
0000:
animation_load "BOMBER"
model.Load(1654)  //dyn
model.Load(1252)  //C4
model.Load(1213)  //mine

load_requested_models


const
     owner = $second_player_Actor 
     owner_press_key =  1 
    Enemy_vehicle =  15@
    Enemy_health = 16@
end 
int Claymore_1
int Claymore_2

int Laser_left 
int Laser_right

int enemy
int audio 
int markered
if actor_defined owner
JF @no_owner_exitsed
IF NOT ACTOR.Driving(owner)
JF @no_owner_exitsed
0812: AS_actor  owner perform_animation "BOM_Plant" IFP "BOMBER" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time 300 // versionB   
04C4: store_coords_to 21@ 22@ 23@ from_actor owner with_offset 0.0 0.5 -1.0 
model.Available( 1213)
jf @no_owner_exitsed
Claymore_1=object.Init(1213,21@, 22@, 23@ )
25@=actor.Angle( owner )
25@ += 180.0
object.Angle( Claymore_1 ) = 25@

markered=marker.CreateAboveObject(Claymore_1)
marker.SetColor(markered,3)
marker.SetIconSize(markered,1)
018B: set_marker markered radar_mode 2

0382: set_object Claymore_1 collision_detection 0
//Start
0400: store_coords_to 20@ 21@ 22@ from_object Claymore_1 with_offset 0.0 0.0 0.6
/////////////////////////////////////////
wait 1000
0400: store_coords_to 23@ 24@ 25@ from_object Claymore_1 with_offset 0.0 0.0 0.0  
06B1: Laser_left = create_searchlight_at 20@ 21@ 22@  radius 0.1 target 20@ 21@ 22@   radius 0.1 
//For the cube trigger
0400: store_coords_to 26@ 27@ 28@ from_object Claymore_1 with_offset  -2.5  -7.0 -1.0 
0400: store_coords_to 29@ 30@ 31@ from_object Claymore_1 with_offset  2.5  -7.0 2.0 

while true 
wait 0 
0AE1: enemy = random_char_near_point 0.0 0.0 0.0  in_radius 999999999.0 find_next 1 pass_deads 1
        if  actor_defined  enemy
        then
        089F: get_actor enemy pedtype_to 18@

            if AND 
           not 18@==8  
       //    06B3:   searchlight Laser_left active
       //     06B3:   searchlight Laser_right active
            object_defined Claymore_1 
            then
            
                 if  
                   
                 //06B7:   searchlight Laser_left spotted_actor enemy
                 //06B7:   searchlight Laser_right spotted_actor enemy
                 0474:   actor enemy near_object_in_cube Claymore_1 radius 6.0 6.0 2.0 sphere 0
               //  05FC:   actor enemy in_cube_fll_corner_at  26@ 27@ 28@ fur_corner_at  29@ 30@ 31@ angle 25@ sphere 0

                 then
                       AUDIO =  Audiostream.Load3D("CLEO\[killstreaks]\timebomb.mp3")
                       AUDIOSTREAM.LinkToObject(AUDIO,Claymore_1)
                       AUDIOSTREAM.PerformAction(AUDIO,PLAY)
                     //Explode Claymore!!
                       06B2: destroy_searchlight Laser_left 
                       0400: store_coords_to 20@ 21@ 22@ from_object Claymore_1 with_offset 0.0 0.0 1.5
                       object.ToggleInMovingList( Claymore_1, 1 )
                       32@ = 0 
                       repeat
                       wait 0
                       034E: move_object Claymore_1 to  20@ 21@ 22@ speed 0.0 0.0 0.4 collision_check 0

                       until 32@ > 1000  
                       0400: store_coords_to 20@ 21@ 22@ from_object Claymore_1 with_offset 0.0 0.0 0.0
                       Audiostream.Release(AUDIO)
                       AUDIO =  Audiostream.Load3D("CLEO\[killstreaks]\claymoreexplode.mp3")
                       AUDIOSTREAM.LinkToObject(AUDIO,Claymore_1)
                       AUDIOSTREAM.PerformAction(AUDIO,PLAY) 
                       0948: create_explosion_at  20@ 21@ 22@    type 7 camera_shake 1.0 
                       0750: set_object Claymore_1 visibility 0
 
                     32@ = 0 
                    0400: store_coords_to 26@ 27@ 28@ from_object Claymore_1 with_offset  -7.0  9.0 2.0
                    0400: store_coords_to 29@ 30@ 31@ from_object Claymore_1 with_offset  7.0 -9.0 0.0 
                     0400: store_coords_to 20@ 21@ 22@ from_object Claymore_1 with_offset 0.0 0.0 0.0
                   
                     repeat
                     wait 0 
                     0AE1: enemy = random_char_near_point 0.0 0.0 0.0  in_radius 999999999.0 find_next 1 pass_deads 1
                     0AE2: Enemy_vehicle = random_vehicle_near_point 0.0 0.0 0.0 in_radius 999999999.0 find_next 1 pass_wrecked 1
 
                     if car_defined Enemy_vehicle
                     then

                         if    
                            01AF:   car Enemy_vehicle sphere 0 in_sphere 20@ 21@ 22@ radius 10.0 10.0 1.2

                           //  00B1:   car Enemy_vehicle sphere 0 in_cube_cornerA 26@ 27@ 28@ cornerB 29@ 30@ 31@
                         then
                             Enemy_health=car.Health(Enemy_vehicle)
                             Enemy_health-=50000
                             car.Health(Enemy_vehicle)=Enemy_health 
                            // car.SetSpeedInstantly( Enemy_vehicle, 10.0)                        
                         end
                     end
                     if  actor_defined  enemy
                     then
                         089F: get_actor enemy pedtype_to 18@
                         if and
                         not 18@==8  
                        // 00A4:   actor enemy sphere 0 in_cube_cornerA  26@ 27@ 28@ fur_corner_at  29@ 30@ 31@ 
                         not  is_char_fallen_on_ground enemy
                         00FE:   actor enemy sphere 0 in_sphere  20@ 21@ 22@ radius 10.0 10.0 1.2

                         then
                             if actor.Driving(enemy)
                             then
                             0851: set_actor enemy decrease_health_by 15000 affect_armour 1
                             else
                             0851: set_actor enemy decrease_health_by 50000 affect_armour 1
                             end
                         end
                     end
                     until 32@ >= 1000
                     
                     WAIT 5000
                     Audiostream.Release(AUDIO)
                     object.Destroy(Claymore_1)
                     break
                 end
            end
        end
   
  
        if  
       //0AB0:   is_key_pressed 20 
        //0AB0:   is_key_pressed 116
        $onmission == 0
        then
            break
        end
end 

:no_owner_exitsed
//Cleanup the whole thing 
if  
06B3:   searchlight Laser_left active 
then
   06B2: destroy_searchlight Laser_left 

end
if object_defined Claymore_1
then
   object.Destroy(Claymore_1)
end
marker.Disable(markered)
animation_release "BOMBER"
model.Destroy(1654)  //dyn
model.Destroy(1252)  //C4  
model.Destroy(1213)  //mine
0A93: terminate_this_custom_script